{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "0436b2bb-71f0-4902-87fc-39189f4ae69e",
   "metadata": {},
   "source": [
    "# Week 1 Exercise and Homework\n",
    "\n",
    "## Exercises:\n",
    "\n",
    "1. **Follow the Design - The Qmod Language tutorial:**\n",
    "   - Write within the IDE with the native syntax a quantum algorithm that coherently calculates \\( y = 2x + 4z + 2 \\) where \\( x \\) and \\( z \\) are quantum numbers represented with 5 qubits each, initialized in a superposition of all possible values.\n",
    "\n",
    "2. **Follow the Design - Quantum Variables and Functions tutorial:**\n",
    "   - Create another quantum function `flip_lsb` that flips the least significant bit.\n",
    "\n",
    "3. **Follow the Optimize - The Synthesis Engine tutorial:**\n",
    "   - Modify the constraints such that you optimize the circuit for minimal circuit depth using a maximum of 25 qubits. What are the circuit depth and width you receive? Are they different from the given example?\n",
    "\n",
    "4. **Open the example from the Analyze - Classiq Visualization Tool tutorial in the IDE:**\n",
    "   - Export it as a LaTeX file, and view it in a LaTeX Editor (it is recommended to use Overleaf - a free, easy-to-use online LaTeX editor).\n",
    "\n",
    "5. **Follow the Execute tutorial:**\n",
    "   - First, adapt the code such that the quantum number \\( x \\) is allocated with 8 qubits. Then, execute the algorithm with 5096 shots and post-process the results from your Python SDK. Plot a graph of all the measured values of \\( x \\) and \\( y \\) with the corresponding axes (make sure you receive the graph of \\( y = x^2 + 1 \\)).\n",
    "\n",
    "## Advanced Exercises:\n",
    "\n",
    "1. **Synthesize 3 different implementations of an MCX (multi-control-X) with 5 control qubits and 1 target qubit:**\n",
    "   - Use the control quantum operation for implementing an MCX, following this tutorial that can be opened in the IDE. One implementation should be optimized for minimized depth, the other for minimized width, and the third somewhere in between (choose yourself what is the maximal width/depth you apply).\n",
    "   - Export the 3 implementations as LaTeX files on the hierarchy level that demonstrates the differences between the implementations.\n",
    "   - Aggregate the implementations in 1 file, export it as a PDF, and explain the key differences. (It is recommended to use Overleaf - a free, easy-to-use online LaTeX editor).\n",
    "\n",
    "2. **Synthesize 2 different implementations of an MCX with 20 control qubits and 1 target qubit:**\n",
    "   - Compare the circuit width and circuit depth required for each implementation.\n"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.11.9"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
